
import http from "../../utils/http_promise.js";

// components/search/Search.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
     word:"",
     houses:[]
  },

  /**
   * 组件的方法列表
   */
  methods: {

    onCancel(){
      // 触发自定义事件
      this.triggerEvent('my_click', {},{});

    },
    
    onConfirm(e){
       this.data.words = e.detail.value;
       this.getData();
    },

    getData(){
       var that = this;
       http.request({
          url:"/house/search",
          method:"post",
          data:{words:that.data.words}
       })
       .then(res=>{
          console.log(res);
          that.setData({
             houses:res.data.data
          })
       })
    }


  }
  
  
})
